//高阶函数作为返回值

function makeFn() {
  let msg = "hello fun";
  return function () {
    console.log(msg);
  };
}

// const fn = makeFn()
// fn()

// makeFn()()

//once
function once(fn) {
  let done = false;
  return function () {
    if (!done) {
      done = true;
      return fn.apply(this, arguments);
    }
  };
}

let pay = once((money) => console.log(`支付了：${money}￥`));

pay(5)
pay(5)
pay(5)
